﻿using MCPlatform.MotionLib.Base.Models;
using Panuon.WPF;

namespace MCPlatform.MotionLib.Base
{
    public interface IMotion 
    {
        public  ushort MotionID { get; set; }
        public  bool IsMoving { get; }
        public MotionParaModel AxisConfig {
            get;
            set; }
        public bool IsError { get; }
        public string ControlName { get; set; }
        public  double ActualVelocity { get; }
        public  double ActualPosition { get; set; }

        public double GetVelocity { get;  set; }

        public double Backlash {  get; set; }

        public bool IsEnabled { get; }
        public  bool IsDone { get; }
        public  ushort ErrorID { get; }

        public bool IsPLimit { get; }



        public bool IsHome { get; }



        public bool IsNLimit { get; }


        public bool IsSPLimit { get; }



        public bool IsEMG { get; }



        public bool IsSNLimit { get; }

        public short SetProfile();
        public  short AbsMove(double Dist);
        public  short HomeMove();
        public  short Jog(ushort dir);
        public  short RelMove(double Dist);
        public  short StopMove();
        public  short Estop();
        public  short Enable();
        public  short Disable();
        public  short Reset();
        public  uint CheckAxisStatus();
        public  short SetVelocity(double velocity);

        public short ChangeVelocity(double velocity, double tAccDec);

        public short SetVelocityRate(double rate);
        public  short SetHomeVel(double Velocity);

        public short SetGearFollow(ushort slaveAxisId, bool enable);

        public short GetGearFollow(ref ushort masterAxisId, ref bool enable);

        public short SetGrantError(bool enable, double dstpError, double emgError);

        public short GetGrantError(ref bool enable, ref double dstpError, ref double emgError);
        public void PauseMove();

        public Task Resume(CancellationToken cancellationToken);

        public Task<(bool, short,string)> AbsMoveAsync(double pos);

        public Task<(bool, short, string)> AbsMoveAsync(double pos,CancellationToken cancellationToken, ManualResetEvent manualResetEvent);

        public Task<(bool, short,string)> HomeMoveAsync(CancellationToken cancellationToken, ManualResetEvent manualResetEvent);

        public Task<(bool, short,string)> RelMoveAsync(double dist, CancellationToken cancellationToken, ManualResetEvent manualResetEvent);

    }
}
